package com.yuetong.inventory.service.impl;

import java.util.List;
import com.yuetong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yuetong.inventory.mapper.YtInventoryProductsMapper;
import com.yuetong.inventory.domain.YtInventoryProducts;
import com.yuetong.inventory.service.IYtInventoryProductsService;

/**
 * 产品Service业务层处理
 * 
 * @author  卓晓君
 * @date 2025-03-21
 */
@Service
public class YtInventoryProductsServiceImpl implements IYtInventoryProductsService 
{
    @Autowired
    private YtInventoryProductsMapper ytInventoryProductsMapper;

    /**
     * 查询产品
     * 
     * @param productId 产品主键
     * @return 产品
     */
    @Override
    public YtInventoryProducts selectYtInventoryProductsByProductId(Long productId)
    {
        return ytInventoryProductsMapper.selectYtInventoryProductsByProductId(productId);
    }

    /**
     * 查询产品列表
     * 
     * @param ytInventoryProducts 产品
     * @return 产品
     */
    @Override
    public List<YtInventoryProducts> selectYtInventoryProductsList(YtInventoryProducts ytInventoryProducts)
    {
        return ytInventoryProductsMapper.selectYtInventoryProductsList(ytInventoryProducts);
    }

    /**
     * 新增产品
     * 
     * @param ytInventoryProducts 产品
     * @return 结果
     */
    @Override
    public int insertYtInventoryProducts(YtInventoryProducts ytInventoryProducts)
    {
        ytInventoryProducts.setCreateTime(DateUtils.getNowDate());
        return ytInventoryProductsMapper.insertYtInventoryProducts(ytInventoryProducts);
    }

    /**
     * 修改产品
     * 
     * @param ytInventoryProducts 产品
     * @return 结果
     */
    @Override
    public int updateYtInventoryProducts(YtInventoryProducts ytInventoryProducts)
    {
        ytInventoryProducts.setUpdateTime(DateUtils.getNowDate());
        return ytInventoryProductsMapper.updateYtInventoryProducts(ytInventoryProducts);
    }

    /**
     * 批量删除产品
     * 
     * @param productIds 需要删除的产品主键
     * @return 结果
     */
    @Override
    public int deleteYtInventoryProductsByProductIds(Long[] productIds)
    {
        return ytInventoryProductsMapper.deleteYtInventoryProductsByProductIds(productIds);
    }

    /**
     * 删除产品信息
     * 
     * @param productId 产品主键
     * @return 结果
     */
    @Override
    public int deleteYtInventoryProductsByProductId(Long productId)
    {
        return ytInventoryProductsMapper.deleteYtInventoryProductsByProductId(productId);
    }
}
